/*----------------------------------------------------------------------------------------
*
*  Copyright 2019, Gao Hai Hui, <fromzeropoint@126.com>.  All rights reserved.
*  https://gitee.com/helloworldghh/xoskit.git
*  Use of this source code is governed by a MIT license
*  that can be found in the License file.
*
----------------------------------------------------------------------------------------*/
#ifndef __XOS_COMMON_SRC_OBJECTS_ID_H__
#define __XOS_COMMON_SRC_OBJECTS_ID_H__

#include "../import/head.h"
#include "../tools/head.h"

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

namespace xos_common
{

	// 
	// id_impl生成器，考虑已有id_impl,生成顺序的不重复id_impl.可以在四字节数值中轮转(去除了-1, 0, 1三个值)
	// 
	class id_impl : public xos_stl::mem_item< id_impl, thread_lock >,
		public xos_set::set_item< int, int >
	{
	public:
		typedef xos_set::set_item< int, int > SET_ITEM;
        typedef id_impl T;

	public:
		id_impl();
		~id_impl();

    public:
        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // 
        static int get_xos_item_data( ITEM_DATA*& item_ptr );

	public:
		int release();
		int init();
		int term();
	};
}

#endif // __XOS_COMMON_SRC_OBJECTS_ID_H__
